package wviz.index;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.StopFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.apache.lucene.analysis.standard.StandardFilter;
import org.apache.lucene.util.Version;


import java.io.Reader;

public class StemAnalyzer extends Analyzer {

  public TokenStream tokenStream(String fieldName, Reader reader) {
   
	  TokenStream result = new StemFilter(
              new StopFilter(true,
                new LowerCaseFilter(
                  new StandardFilter(
                    new StandardTokenizer(
                     Version.LUCENE_35, reader)  )),
                     StopFilter.makeStopSet(Version.LUCENE_35,
         					StopWords.ENGLISH_STOP_WORDS))
             );
    return result;
  }
  
  
//	Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_35,
//			StopFilter.makeStopSet(Version.LUCENE_35,
//					StopWords.ENGLISH_STOP_WORDS));
}
